const http = require('http');


const server = http.createServer((request, response) => {
    response.setHeader('content-type', 'text/html;charset=utf-8')
    let { pathname } = new URL(request.url, 'http://127.0.0.1');
    let { method } = request

    let text = 'Not Found';
    if (method === 'GET') {
        switch (pathname) {
            case '/login':
                text = '登录页面'
                break;
            case '/reg':
                text = '注册页面'
                break;
            default:
                break;
        }
    }
    console.log(text)
    response.end(text)
})


server.listen(9000, () => {
    console.log('启动成功...')
})